package com.fingersoft.im.view

import android.content.Context
import androidx.viewpager.widget.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent

/* todo  move to common */
class SwappableViewPager : androidx.viewpager.widget.ViewPager {
    var pageSwappable: Boolean = false

    constructor(context: Context) : super(context)

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)

    override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
        return this.pageSwappable && super.onInterceptTouchEvent(event)
    }

    override fun onTouchEvent(event: MotionEvent): Boolean {
        return this.pageSwappable && super.onTouchEvent(event)
    }
}
